const OPTION_VAL = 'option-val'
export default {
	// 保持方案设置
	namespaced: true,

	state: {
		val: uni.getStorageSync(OPTION_VAL) || '',
	},
	mutations: {
		// 保存数据到storage
		saveToStorage(state) {
			uni.setStorage({
				key: OPTION_VAL,
				data: state.val
			})
		},
		setVal(state, data) {
			state.val = data
			this.commit('option/saveToStorage')
		}
	},
}